package study.saas.order.facade.impl;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.stereotype.Component;
import study.saas.common.viewmodel.ApiResultV2;
import study.saas.common.viewmodel.PageModel;
import study.saas.order.entity.Commodity;
import study.saas.order.service.CommodityFacade;
import study.saas.order.service.CommodityService;
import study.saas.order.service.model.*;

import javax.annotation.Resource;


/**
 * @author zxx
 */


@Component("CommodityFacade")
@Service(version = "1.0.0")
public class CommodityFacadeImpl implements CommodityFacade {

    @Resource
    private CommodityService commodityService;


    @Override
    public ApiResultV2 addCommodity(CommodityAddDTO add) {

        return commodityService.add(add);
    }
    @Override
    public ApiResultV2 modifyCommodity(CommodityModifyDTO modify) {

        return commodityService.modify(modify);
    }

    @Override
    public ApiResultV2 deleteCommodity(String commodityName) {
        return commodityService.delete(commodityName);
    }

    @Override
    public ApiResultV2 removeCommodity(String commodityName) {
        return commodityService.remove(commodityName);
    }

    @Override
    public ApiResultV2 upCommodity(String commodityName) {
        return commodityService.up(commodityName);
    }


    @Override
    public ApiResultV2 decreaseCommodity(CommodityDecreaseDTO decrease) {
        return commodityService.decrease(decrease);
    }

    public ApiResultV2 increaseCommodity(CommodityIncreaseDTO increase) {
        return commodityService.increase(increase);
    }

    @Override
    public ApiResultV2<Commodity> get(String commodityName) {
        return commodityService.get(commodityName);
    }

    @Override
    public ApiResultV2<PageModel<Commodity>> listCommodity(CommodityFilterDTO filter) {
        return commodityService.list(filter);
    }
}
